package cn.kgc.api.entity;

import java.util.ArrayList;
import java.util.Date;
import java.io.Serializable;
import java.util.List;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "menus")
@SuppressWarnings("serial")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class Menus extends Model<Menus> implements Serializable {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 菜单名称
     */
    @TableField(value = "menu_name")
    private String menuName;

    /**
     * 1菜单 2按钮
     */
    @TableField(value = "menu_type")
    private Integer menuType;

    /**
     * 菜单编码
     */
    @TableField(value = "menu_code")
    private String menuCode;

    /**
     * 菜单路由
     */
    @TableField(value = "path")
    private String path;

    /**
     * 父菜单ID
     */
    @TableField(value = "parent_id")
    private Integer parentId;

    @TableField(value = "redirect")
    private String redirect;

    @Version
    private int version;

    /**
     * 创建时间
     */
    @TableField(value = "creationDate", fill = FieldFill.INSERT)
    @JsonIgnore
    private Date creationDate;

    /**
     * 权限标识符
     */
    @TableField(value = "perm")
    private String perm;

    @TableField(value = "component")
    private String component;

    /**
     * 图标
     */
    @TableField(value = "icon")
    private  String icon;

    /**
     * 子菜单集合
     */
    @TableField(exist = false)
    private List<Menus> children=new ArrayList<Menus>();
}
